package model;


import config.Config;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 教练
 * Created by root on 17-6-14.
 */
public class Coach {
    public Map<java.lang.Integer, Integer> studentMap;
    public List<Integer> studentlist;
    public List<CClass> cClasses;
    public int id;

    public Coach(int id) {
        this.id = id;
        this.studentMap = new HashMap<>();

        this.studentlist = new ArrayList<>();
        this.cClasses = new ArrayList<>();
    }

    public int findDay_h_notenough(curriculum curriculum, List<Integer> src, Config c, CClass cClass) {

        Student stu;
        for (int i = 0; i < this.studentMap.size(); i++) {
            int stuid = curriculum.coaches.get(id).studentMap.get(this.studentlist.get(i));
            stu = curriculum.students.get(stuid);
            if (stu.day_classhours + cClass.getHours() <= c.day_h_max
                    && stu.week_classhours + cClass.getHours() <= c.week_h_max
                    && stu.all_hours + cClass.getHours() <= c.subject2_h
                    ) {

                boolean exist = false;
                for (int s : src) {
                    if (s == stu.stuid) {
                        exist = true;
                    }
                }
                if (!exist) {
                    return stu.stuid;
                }

            }
        }
        return -1;
    }

}
